Visual portals to simulate a seamlessly looping area
I'm trying to simulate a world that creates the illusion of looping seamlessly in the horizontal direction. As far as moving objects go this should be easy: If the world is 100 units large, objects reaching position X = 100 will be teleported to X = 0, same for Z and vice versa. But I don't know what the best approach would be for the visual part.
I'm assuming I'll need to box the scene in between 4 planes, all perfectly aligned and facing inward: -X, +X, -Z, +Z. But how do make it so for instance, the -X plane renders a portal from the +X plane, and does so with the proper proportions to create the illusion of seeing from that position and angle? Is there a shader or render-to-texture script that could help out with this?