D Trajectory Creation

Input: pink shaft of Reuleaux triangle.
Output: violet horizontal pin. In the view from above its trajectory is a square. Orange cam makes the pin move in vertical plane while it moves along one side of the said square.
The video shows an application of this mechanism: displacing the red bush.