Hello, axl456!
This takes quite a bit of work . . .
We have points and
Let: = the angle at
Let:
Code:

 (x2,y2)
 ♥ P2
 R * 
 *  y2y1
 * @ 
 P1 ♥*
 (x1,y1) x2x1

  +               

Then we have: .
Let:. .
Code:
 C
 *
 \
  \
 A  \ ∆x
 * .♥.
 \ * P2\ 
 ∆y \ * \  ∆y
  \P1 * \
 .♥. *
 ∆x \  D
 \ 
 \
 *
 B

  +               

To move from to : .move left and up
. . Hence: .
To move from to : .move right and down
. . Hence: .
To move from to : .move left and up
. . Hence: .
To move from to : .move right and down
. . Hence: .