How to center shapes in p5.js

tk

tk.

Circle.

works out of the box.

Square.

tk.

tk.