This article describes how to correct the orientation of a photo that has been rotated sideways.
How to Rotate a Photo on iPhone – Flip Photo on iPhone
To change the orientation of your photos, try one of the following solutions:
Open the image in an image-editing program that displays EXIF information, such as Adobe Photoshop or the free IrfanView. In IrfanView, the Image > Info command displays basic data, and a button at the bottom of the window opens a separate EXIF data view. If the image does not display EXIF data, the software cannot orient it properly.
To modify or remove EXIF data, use Windows Explorer. Right-click the image and select Details to display a screen of metadata, including EXIF data, which you can modify if the image supports it.