What is the name of this sliding collapsing square tool?
I think what you have is an adjustable viewfinder, a tool used by artists to help frame a scene.

By sliding the arms along the guides you are able adjust the view of the scene you are trying to capture.

Helps the artist to learn how to control the content, design and layout of an image.

Here's an example from the Derwent company. 

[

Here's an example of someone using their fingers.