Function for stimulus wraparound/tiling?

I have a set of stimuli which are tileable, where they seamlessly repeat from left/right up/down.

I want to randomly shift the center of a given stimulus. I can do this by loading the image as a matrix, then chop it apart and reassemble it.

For example, I have an image:

im1

Suppose I want to shift it so the upper-left corner (pixel [1,1]) is in the center, like with a fftshift.

I identify the four quadrants of the image as A,B,C,D:

im1 = [A B;C D]

then I can reassemble these as:

im2 = [D C;B A]

This seems dumb though, and I wonder if there’s some capability in psychopy to tile a stimulus and view it through an aperture, without having to load it as a matrix? It seems like varying phase of a grating stimulus works kind of like this:

https://www.psychopy.org/builder/components/grating.html

more specific example, I can do this:

img1 = Image.open(imdir + imlist[T] + ‘_1.png’)
image_array1 = np.array(img1)

shift_x = 200
shift_y = 200
image_array1 = np.roll(image_array1, shift=(shift_y, shift_x), axis=(0, 1))

then display image_array1. But can the same thing be accomplished without creating img1 or image_array1, within visual.ImageStim?