Take the ratio in each axis and use the smaller one. So if you start with $2000 \times 1000$ the horizontal is $\frac {800}{2000}=0.4$, the vertial is $\frac {600}{1000}=0.6$. So you scale by a factor $0.4$ and the vertical is $0.4 \cdot 1000=400$. These are rectangles, not squares.