I think you need to decide how important some aspects are with regards to others, but you could simply calculate the size of the image (width x height) and use that as the first part of the score. How I'd score this would be to record the area of largest image on the page and work out the others as a percentage of this. I don't think the average image size really adds anything here as I would imagine the largest image is most likely the product image.
Then calculate a separate score for the squareness, doing something like this:-
if (height > width) {
result = (width/height) * max_points_for_squareness;
} else {
result = (height/width) * max_points_for_squareness;
}
So between those two aspects you get two percentages that can be used to distribute a total score however you wish (you could assign more points to squareness if you so wish, or more to image size.