It would seem that rotating an image is a trivial task, however I face this problem when working with Multilayer EXR format files in Blender.
But why?
I find it convenient to set my archvis scenes up as animations so I can change objects in different stills and render all camera angles at once as animation. I sometimes need landscape and portrait orientation images of the same interior and use a small script to quickly switch X and Y resolution dimensions and then rotate the camera when I am done framing so some frames render out rotated. It's then very convenient for me to do compositing on a sequence of images.
Recently I rendered a scene in a few batches and ended up with 1 8K panoramic image, 5 4K living room images in landscape orientation with one of them rotated and 5 images of stairs that are all portrait orientation all in a sequence and to my surprise when compositing I can do that with all the images at once as one sequence despite the difference in orientation and resolution and output them to files with File Output nodes to their correct resolution and orientation from that one sequence. So now I know, I can have different orientation in the same sequence which is amasing.
It would be even more amazing if I could always look at all the images rotated correctly while compositing instead of rotating only the output as I have done until now.
It would require me to rotate all the rendered Multilayer EXR files that need rotation in my sequence of files.
What I have tried
I have no problems connecting every output of a Multilayer EXR to File Output node with Python and also inserting any Compositor nodes to edit them automatically so any solution that works for one layer is convenient for me, however I cannot rotate the image in compositor as far because the image is cropped to original dimensions when rotated:
The question
Is it possible to rotate every layer of a Multilayer EXR and output it to an image with rotated dimensions as well with Blender's Compositor nodes, if it is - how?
My solution detailed in and answer below has issues with Cryptomatte. I am starting a bounty in hope to find a solution without those issues. I am starting to think of a solution with Python, but have no idea how it would be simple and easy to use from Blender...