Signal Processing using Fourier Transform
The signals that we measure in MRI are a combination of signals from all over the object being imaged. It so happens that any signal (even if you simply make one up and draw a squiggle) is composed of a series of sine waves, each with an individual frequency and amplitude. The Fourier transform allows us to work out what those frequencies and amplitudes are. (That is to say, it converts the signal from the time domain into the frequency domain.) 

Since we encode the signal with magnetic field gradients which make frequency and (rate of change of) phase relate to position, if we can separate out the frequencies we can say where we should plot the amplitudes on the image.

The amplitudes serves as the brightness levels in the image:

$Amplitude = I$

$(Phase, Frequency) = (x,y)$

$I(x,y) = I(x i + y j)$

Phase and Frequency help to find where in the image(which exact part of the  MRI) has the particular amplitude measured by the technique of passing RF signals through the body and collecting the signal information.

The exact process is well explained with animations at:
http://www.imaios.com/en/e-Courses/e-MRI/Signal-spatial-encoding

An RF pulse does not have one frequency only (for this, it would need to be of infinite duration). It covers a certain bandwith, which depends on the shape of the pulse and its duration.

The thickness of the slice can be varied by adjusting the bandwidth of the selective pulse  and the amplitude of the slice selection gradient.

For a fixed amplitude gradient, the wider the bandwidth, the greater the number of protons excited and the thicker the slice
For a fixed bandwidth, the stronger the gradient, the greater the variation of precession frequency in space and the thinner the slice

Moreover, the shape of the RF pulse in time will also determine the bandwidth profile in frequency, and thus the slice profile.