Setting box-size with mouse

I want to make it possible, to set the size of a rectangle for example, by dragging on the little squares.
what would be the best solution to do that?

There’s a good solution here:

1 Like