This occurs on both iOS and Android when pics are attached using vbulletin. Took me forever to figure out. Sometimes they will post upside down, too.lol Sometimes they post fine.
When taking a pic always make sure the menu button is facing to the right. The pics will post properly.
I can rotate the pics without an image hosting company, but as you stated, they will format properly in the preview box but still post sideways if the menu button is on the left or the phone/tablet is used in the vertical position.
Give it a few tests and let us know.
This seems to be specific to vbulletin. I've never had it occur on any other format.