A torus is an infinite surface where the top joins the bottom, and
the left side meets the right side. See https://en.wikipedia.org/wiki/Torus
for a full mathematical description.
In this function, the torus effect is achieved by adding the specified
number of rows of the top of the raster to the bottom (and vice versa) and
the specified number of rows of the right of the raster to the left (and
vice versa)