Tiled Gallery: Extracted layouts to files.

Different layouts (square and rectangular) extracted to different files with some code sharing (abstract class).