Rotate object around pivot point

I am trying to rotate 2 objects around pivot points.
In this fiddle they are rotating around their center: Edit fiddle - JSFiddle - Code Playground
In this fiddle they are rotating around a pivot point: Edit fiddle - JSFiddle - Code Playground, but they are overlapping each other (their pivot point is the one marked with the violet circle and the green ones are the desired pivot points


). The desired rotation would be like this: .