A magnetic field sensor for sensing a movement of an object operable to move along one and only one path, wherein a movement line is tangent to the path, the magnetic field sensor comprising: a magnet, the magnet comprising a magnet surface, a north pole, a south pole, and a magnet axis passing through the north pole and the south pole; a semiconductor substrate proximate to the magnet and at a position between the object and the magnet surface, the semiconductor substrate having first and second surfaces opposing each other, the magnet axis substantially perpendicular to the first surface of the semiconductor substrate the semiconductor substrate having first and second orthogonal axes (1530, 1532) on the first surface of the substrate, intersecting at a substrate point on the first surface of the substrate, wherein the magnet axis intersects the substrate point, wherein, for any movement line tangent to the path, a projection of the movement line onto the first surface of the semiconductor substrate is substantially parallel to the first orthogonal axis on the first surface of the substrate; a first magnetic field sensing element disposed on or under the first surface of the semiconductor substrate, wherein the first magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the first orthogonal axis; a second magnetic field sensing element, disposed on or under the first surface of the semiconductor substrate wherein the second magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the second orthogonal axis wherein, for any movement of the object, the second magnetic field sensing element is substantially less responsive to the movement than is the first magnetic field sensing element; a third magnetic field sensing element disposed on or under the first surface of the semiconductor substrate, wherein the third magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the first orthogonal axis; and a fourth magnetic field sensing element disposed on or under the first surface of the semiconductor substrate, wherein the fourth magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the second orthogonal axis wherein, for any movement of the object, the fourth magnetic field sensing element is substantially less responsive to the movement than is the third magnetic field sensing element. a magnet, the magnet comprising a magnet surface, a north pole, a south pole, and a magnet axis passing through the north pole and the south pole; a semiconductor substrate proximate to the magnet and at a position between the object and the magnet surface, the semiconductor substrate having first and second surfaces opposing each other, the magnet axis substantially perpendicular to the first surface of the semiconductor substrate the semiconductor substrate having first and second orthogonal axes (1530, 1532) on the first surface of the substrate, intersecting at a substrate point on the first surface of the substrate, wherein the magnet axis intersects the substrate point, wherein, for any movement line tangent to the path, a projection of the movement line onto the first surface of the semiconductor substrate is substantially parallel to the first orthogonal axis on the first surface of the substrate; a first magnetic field sensing element disposed on or under the first surface of the semiconductor substrate, wherein the first magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the first orthogonal axis; a second magnetic field sensing element, disposed on or under the first surface of the semiconductor substrate wherein the second magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the second orthogonal axis wherein, for any movement of the object, the second magnetic field sensing element is substantially less responsive to the movement than is the first magnetic field sensing element; a third magnetic field sensing element disposed on or under the first surface of the semiconductor substrate, wherein the third magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the first orthogonal axis; and a fourth magnetic field sensing element disposed on or under the first surface of the semiconductor substrate, wherein the fourth magnetic field sensing element comprises an axis of maximum sensitivity substantially parallel to the first surface of the substrate and substantially parallel to the second orthogonal axis wherein, for any movement of the object, the fourth magnetic field sensing element is substantially less responsive to the movement than is the third magnetic field sensing element.