Added logic to center a row/column when there is only 1 row or 1 column in the grid

Before this change, a single row or column would be aligned to the bottom and left respectively. As a result I added logic to center a row/column.