Rotate/Swivel object from 2 moving points?
The gif below is sort of what I'm going for. The green and red points need to move along their respective axis, but I need each point to be fixed at either end of the rectangle. Essentially, the points are moving along the axis and the rectangle keeps the distance between them exactly the same at all times. The rectangle would swivel and rotate along each point simultaneously as they move.

I tried following this tutorial, but it didn't seem to work for what I'm doing.
https://www.youtube.com/watch?v=E3utKyifwLA&ab_channel=VisionaryFire

