While I'm not entirely certain, the general idea is that you need to solve all 16 puzzles. Once you do, a ghost will appear—place one of the villagers on it, and you'll have uncovered the secret.