I tend to use my infantry 3 ranks deep, as was usual practice in the 18th century. I have also tried 2 ranks, 4 ranks, and 5 ranks, and found that being 3 deep really does seem to be the most effective way, especially after you get fire-by-rank.

As for squares, if they didn't work, Napoleon wouldn't have bothered, right? But I agree that there should be harsher penalties for forming a square too late. Perhaps not an instant rout, but certainly more losses and less kills. Maybe it shouldn't actually be possible to form a square while engaged...