Is it possible to know at what distance of the camera from the cube the height of the perspective projection of the cube will be equal to the height of the screen?

We can project all the vertices of the cube into camera space. But at what distance from the camera will the projection of the top point be equal to 1, and the bottom -1?