I've tried to use affine transformation to match shapes and used, area of symmetric difference between target and match shapes (D) to calculate
P = 1 - D/AreaOfShapeToMatch:
Result looks like this:
To find transformation coefficients using least squares technique shouldn't be a challenge if you know how to match points.
You cannot use this technique to compare triangles, because any 2 will match. The same with rectangular shapes. Rectangle will match square.