Why a photo shows up rotated
Cameras always save the photo in the same position and record separately, in the metadata, how the device was being held. Some programs and websites ignore that note and display the image sideways. When you rotate it here, the rotation is applied to the actual pixels, so it will look right everywhere.