A librarian decided to arrange books on a shelf. She placed 8 books in a row and made sure every row had the same number of books. How many books were there if the arrangement was square (i.e., the same number of rows as there were books in a row)?