How to shift a signal to the center of the frequency domain? Let's assume I have a 1024 x 1024 matrix that represents the spatial domain.  After I perform a FFT and center the frequencies, I get the a signal that looks like the following in the frequency domain.  Let's say that this signal is centered around (812, 812).  Now, I want to shift this to the center of the frequency domain.



Now, what exactly qualifies as the center of the frequency domain?  Is it (512, 512), (512, 513), (513, 512), or (513, 513)?  If I perform the inverse FFT to the shifted signal, and plot the phase of the complex signal, I get results that look like the following.



If I shift to other centers (512, 513), (513, 512), or (513, 513), I get a similar slowly-varying frequency in my background.  Whereas in the original signal, the phase of the background is constant.

Consequently, what is the best way to ensure that shifting to the center faithfully represents this constant background phase?
I've found that shifting to (513, 513) works best, because in MATLAB, the zero frequency is at the upper left corner of the unshifted Fourier transform.  The operation fftshift flips the 1st and 3rd quadrants, meaning that the zero frequency is now at the top-left of the bottom-right quadrant.