A magic square over $\mathbb{Z}$ is an n x n matrix whose entries are $\{1, \ldots, n^2\}$, with the sum of every row and column identical (in particular, my magic squares are all normal, but the sum of diagonal entries need not equal the sum of the rows/columns, which is necessarily $\frac{n(n^2+1)}{2}$). A magic square over $\mathbb{Z}_m$ is the same, except that $\{1, \ldots, n^2\}$ should be interpreted as a multiset of congruence classes modulo m.
Suppose I have an n x n magic square over $\mathbb{Z}_m$. Is there a simple way to tell if it is the image of a magic square over $\mathbb{Z}$ under the (element-wise) canonical projection map $a_{i,j} \mapsto a_{i,j}+m\mathbb{Z}$?
It's easy to come up with examples that are the image of a magic square. But not every one is. Two examples where this may fail are: $m=n=2$
$A= \left( \begin{array}{ccc} 1 & 0 \\ 0 & 1 \end{array} \right)$
and
$m=n=3$
$A= \left( \begin{array}{ccc} 1 & 2 & 0 \\ 1 & 2 & 0 \\ 1 & 2 & 0 \end{array} \right) $
Adding the identity to A in this case gives another counterexample of a slightly less trivial nature.
However, for $m=2$, $n=3$, every magic square over $\mathbb{Z}_2$ is the preimage of a magic square over $\mathbb{Z}$. This is extremely easy to see, since there are 5 ones and 4 zeros, so the matrix must be the image of the Lo Shu Square (up to permuting rows and columns).There are no magic squares with $m=3, n=2$. There are doable larger cases, but none of the ones I tried gave anything that seemed generic.
In general, what I would expect is that for m large compared to n, there won't be any additional ones; this is obvious if $m \ge n^3$ (better bounds are certainly possible). But for m small and n large, there might be more magic squares. And of course, if $m|n$ then cases like the 3x3 above will probably crop up.
The question I'm more interested in than the sort of general results above, though, is for a particular magic square over $\mathbb{Z}_m$, what is a fast way to check if it is the image of a magic square over $\mathbb{Z}$ (if such a way exists at all).