Virtually any time the American flag is depicted or flown, it has the orientation seen in the following image, with the stars in the upper hoist (left) quarter of the flag:
However, when the flag is displayed as a patch on the right shoulder of a military, police, or fire uniform, it's orientation is right-left reversed, as shown here:
When did this reversal originate, and what is the reason for it?