A photo is usually a projection, the conserved quantity in a projection is the cross ratio of four points on a line. So, for calculation purposes, you want to already know that your credit card shares lines with your box. This approach indeed necessitates more than one picture.
I will first assume that you know the mid-points of the side of your credit card and that the side of the credit card coincide with two sides of the box (that is, the credit card is places directly in a corner).
We will just look at one side of the box and the credit card now, the other calculation is analogous:
Now, measure in your photo $a=$ length from corner to mid-point of credit card side, $b=$ length from mid-point of credit card side to end of credit card side, $c=$ length from corner to other corner of unknown box and $d=$end of credit card side to other corner of unknown box.
Denote $l$ the length of this side of the credit card and $x$ the unknown length of the side of the box.
You have: $\frac{a}{b}\frac{d}{c}=\frac{x-l}{x}.$
So, $x= \frac{lbc}{bc- ad}.$
How you can recover a mid-point of a credit card side (or more precisely, $a$ and $b$ as above):
Two points, their mid-point and the point at infinity of that line have cross-ratio -1. The two parallel sides of the credit card intersect at the point at infinity. Therefore, with $a,b$ as above, $e$ the length of the credit card in the picture and $m$ the distance of the beginning of the credit card side to the intersection of the credit card side with its "parallel" one in the picture, you get: $\frac a{e-a} \frac {m-e}{m} = -1$
which permits you to calculate $a$.