By default, dim=-1, swaps the first quadrant of x with the
third, and the second quadrant with the fourth. If dim=1, swaps rows 1
to middle with rows (middle+1) to end. If dim=2, swaps columns 1
to middle with columns (middle+1) to end. If dim=3, reverse fftshift.