A lot of software will automatically reorient the pictures for display on your computer. When you upload them to ATP or other places the raw data is typically what's transmitted so they can show up rotated. The initial picture is just a result of which way the sensor in your camera was oriented when you took the picture. In short, it's often a crap shoot.