I am just giving an example, how it can be written as a swrl rule. Please note that this is not tested and may not be accurate. so, consider this as only a clue.
Shape(?s),hasCordinates(?s,c1),hasCordinates(?s,c2),hasx(?c1,?x1),hasy(?c1,?y1),subtract(?x1,?y1,?diff1),hasx(?c2,?x2),hasy(?c2,?y2),subtract(?x2,?y2,?diff2),pow(?diff1, 2, ?sq1),pow(?diff2, 2, ?sq2),add(sq1,sq2,?sum1).....(?sum2).....-> issquare(?s)
Please note that there would be more efficient ways to do this.