Seems to me this would be easier if you had all the squares that make up the shape. Then you could go through that list of squares, and count how many edges of each square are not shared with another square in the shape. Here is a graphical representation of the example you gave:
Code:
.......
.xxxxx.
.x212x.
.x201x.
.xx22x.
.xxxxx.
.......
I have used a . to mean squares of no significance, an x to symbolize the points you were given, that lie on the outer edge of your shape, and a number to represent the "perimeter value" of each square. Corners contribute 2 units to the perimeter, edges contribute 1 unit, internal shapes contribute 0, etc.
I hope that gets you going in the right direction.