The Timeless Treasures of Literature [First Volume, Last Volume] (Bungaku Bandai no Takara (Shinomaki, Suenomaki)
Painted by Issunshi Hanasato During the Kōka period (1844-1848) Tokyo Shiryō Collection 3920-C1-1,2

These works are a two piece nishiki-e (colored woodblock print) series depicting a class at terakoya (temple school). A male teacher teaches the class at "Shinomaki" (first volume) and a female teacher at "Suenomaki" (end volume). You can see that most of the children behave freely.

At terakoya (temple school) in the Edo period, not all students sat facing the teacher, the textbooks used and the ages of children varied and attending the class or not was optional.
Most children in the picture are not studying quietly. There are indeed many kinds of going on with some children fooling around with ink brushes and others punching each other or playing with dolls. Also from books behind the female teacher in "sue-no-maki" (end volume), we can see that flower arrangement, tea ceremony and incense burning were taught in addition to reading and writing.
This being said, the teachers at terakoya teachers strictly instructed morals, manners, and rules of decorum and there was a fixed set of rules in the class with punishments for excessive misbehavior whereby children were made to stand still or sit erect with legs folded.