Adds the given margins to the given rectangle and rotates and flips the rectangle according to the respective styles in style.