Drawing objects is usually easy but for precision alignment you need to know exactly how objects are drawn.

When drawing lines the pen hangs below and to the right of the coordinates you have chosen.

When drawing objects within Rects they are drawn to fit inside the Rect you have specified.