partial implementation of Rectangle tool