Exif rotation in browsers is a journey of disappointment. The definitive guide on the history of it is quite an interesting read. There's also a current state of the world round-up written in 2012, which is pretty much still the same in 2019.
Firefox supports a CSS attribute that tells the browser to respect exif rotation, but no other browser respects it. There's been a Chrome ticket open to fix it for about five years now.
This is a little proof of concept to try to fix the issue with CSS transforms. We didn't end up using it because we had the images in other elements that were already rotated themselves, so we felt like this would probably cause more problems than it solved. But who knows, maybe it will be useful some time! We decided it would be better to just process the images on the server instead.
The trick to getting it to work is to put your images in another container with a width and height set on it. This reserves the space the image will need in the document's flow when it is in it's correct rotation.