Here's an example of a related bug. This one makes sense to me. This is with an inner window, and an inverted (rotation = 180) card.

As the UI is scrolled, the code detects that there isn't enough room to draw the frame and clips it. However, it doesn't realize the frame has been rotated, so it clips the wrong edge, and fails to clip the correct edge (thus not drawing what it should, and also drawing what it shouldn't - outside the window).

Clipping 2.png