Finding indices and number pixels for rectangle shapes

This module will find the indices of rectangle or square shape and count the
  number of pixels in that shape.

You should not need `if ... else ...` any more as the slices truncate them selves at the edge.