For shearing along X axis, shearfactor* (y coordinate) is added with x co-ordinates of all points. That is:
newx=oldx+shearfactor*oldy
Similarly, to shear along Y axis, we add shearfactor* (x coordinate) to y co-ordinates of all points.
newy=oldy+shearfactor*oldx