Given points A and B, and a line p with its equation $p:\vec{r}=\vec{r_{p}}+t\vec{p}, t\in R$ such that $\vec{p}$ is not parallel to $\vec{AB}$. Find points C and D, as a function of $\vec{r_{a}}, \vec{r_{b}}, \vec{r_{p}}$ and $\vec{p}$ such that ABCD form a rectangle, whose intersection of diagonals lies on line p.
I'm kinda stuck at the beginning. It would be ideal if someone can give me the general way of thinking about this kinds of problems.