Books were neatly stacked in the corner of the room.

Literal

Room's corner [in-に] books [subject-が] neatly stacked was.

積み重ねる is a compound verb (積む + 重ねる). The passive-resultative ~られていた describes the state of the books having been stacked.