1. A method of correcting image distortion, the method comprising: storing an image of a physical object captured by a device that includes a camera; analyzing the image to detect at least one convex quadrangle of arbitrary shape within the image; generating a plurality of additional convex quadrangles, wherein a respective vertex of a respective additional convex quadrangle is in a pre-determined vicinity of a corresponding vertex of the at least one convex quadrangle within the image; generating a plurality of linear projective mapping matrixes, including, for each of the at least one convex quadrangle and the plurality of additional convex quadrangles, generating a respective linear projective mapping matrix; using the plurality of linear projective mapping matrixes to map each of the at least one convex quadrangle and the plurality of additional convex quadrangles onto a unit square; determining a plurality of estimated focal lengths of the camera using the mappings of the plurality of linear projective mapping matrixes onto the unit square; using the at least one convex quadrangle to determine the aspect ratio of the image in response to a range of the plurality of estimated focal lengths including a true value of the focal length of the camera; and correcting distortion of the image using the determined aspect ratio.