**Iff $k=6\cdot(n^2+m^2)$.**

It is obvious if the tiling is vertex-to-vertex.

If the tiling is not vertex-to-vertex, you get a closed geodesic formed by overlaping sides.
Then you can shift squares on one side of the geodesic to make the tiling "more vertex-to-vertex".
Repeating this operation you can make the tiling to be vertex-to-vertex.