Wanted to re-use some of my old projects, so I made this magic box effect using Cryptomatte in blender.
Here is the process:
The different “worlds” are all on top of each other but in their own separate render layers. Each render layer has all the others disabled. Then I added a plane in front of each world and used cryptomatte to mask out one face per render layer, finally you just mask each render layer out on top of the previous one in the compositor and it gives you this effect