Pinned Squares

Age 14 to 16 Challenge Level:

Pin those squares down! A geoboard is a piece of wood with pins hammered into it. The diagram shows a 5 by 5 board with 25 pins set out in a square array. Squares are made by stretching rubber bands round specific pins as shown. What is the total number of squares that can be made on a 5 by 5 board? 

pinned board

How many squares can be made on an N by N board?
 
A virtual pinboard is available here.