  We provide the foundations of a Hilbert space theory for the short-time
Fourier transform (STFT) where the flat tori \begin{equation*}
\mathbb{T}_{N}^2=\mathbb{R}^2/(\mathbb{Z}\times N\mathbb{Z})=[0,1]\times
\lbrack 0,N] \end{equation*} act as phase spaces. We work on an $N$-dimensional
subspace $S_{N}$ of distributions periodic in time and frequency in the dual
$S_0'(\mathbb{R})$ of the Feichtinger algebra $S_0(\mathbb{R})$ and equip it
with an inner product. To construct the Hilbert space $S_{N}$ we apply a
suitable double periodization operator to $S_0(\mathbb{R})$. On $S_{N}$, the
STFT is applied as the usual STFT defined on $S_0'(\mathbb{R})$. This STFT is a
continuous extension of the finite discrete Gabor transform from the lattice
onto the entire flat torus. As such, sampling theorems on flat tori lead to
Gabor frames in finite dimensions. For Gaussian windows, one is lead to spaces
of analytic functions and the construction allows to prove a necessary and
sufficient Nyquist rate type result, which is the analogue, for Gabor frames in
finite dimensions, of a well known result of Lyubarskii and Seip-Wallst{\'e}n
for Gabor frames with Gaussian windows and which, for $N$ odd, produces an
explicit \emph{full spark Gabor frame}. The compactness of the phase space, the
finite dimension of the signal spaces and our sampling theorem offer practical
advantages in some applications. We illustrate this by discussing a problem of
current research interest: recovering signals from the zeros of their noisy
spectrograms.
