The sharp threshold for making squares