Out of universe, the answer is - as it usually is - that JKR is bad at maths. She likely didn't consider the kind of workload or number of lessons that would be required for there to only be a single teacher per subject.
However, let's see if we can make it work in-universe.
You stated in the question that there are seven years split between four Houses, so that gives us a starting point of 28 classes. If we assume that every year and House combination ("class") takes every subject once per week, that's 28 lessons per week.
Some subjects are taught to two Houses from the same year at once - for example, Harry and the other Gryffindors took Potions and Care of Magical Creatures with the Slytherins and Herbology with the Hufflepuffs. That may reduce the number of required lessons for some of those subjects, but not all; Potions explicitly has double periods mentioned, but I don't know if the same is true of other shared subjects, such as Care of Magical Creatures. Worst case is that it's the same amount of teaching, best case is that they save a few lessons worth of time each week.
We saw in Harry's sixth year that the number of students taking certain subjects at NEWT level was considerably lower. There only appeared to be a single sixth year class taking Slughorn's Potions class, for example. It's more likely that there's only one or two NEWT classes per subject for sixth and seventh year students. If we assume four classes (or two double periods) per year for the first five years, and only two classes per year for the last two, that brings us down to 24 lessons per week. That's probably the worst case for the core subjects.
Not all classes are taught to every year - Harry doesn't start Divination until year three - which would reduce the amount of lessons required per week by eight, so we're down to 16.
For optional classes, some subjects such as Divination seem to be (confusingly) popular, whereas others aren't. 16 lessons is our upper limit for a subject that's optional and starts in the third year, but if only one class worth of students choose to take it each year, then that drops down to only five(!!) lessons per week.
In some years, nobody opts to take a subject. I'm not sure Hagrid taught any NEWT classes to sixth years during Half-Blood Prince, for example, which would free up time in a teacher's schedule.
That assumes that each class only took a subject once per week, which isn't necessarily realistic. At least in Harry's first few years he seemed to have multiple Transfiguration and Potions lessons per week. It's possible that the later years have less classroom time due to (assumed) overall greater magical proficiency, a shorter amount of time required to practice new spells, and more theoretical study being given as homework. If we assume that each class takes every subject twice per week, rather than once, then you're looking at 48 to 56 lessons per week for a core subject (e.g. Transfiguration) and perhaps ten per week for an unpopular, optional one.
In conclusion, some Hogwarts teachers likely had very relaxed schedules (possibly teaching only ten or so lessons per week) and others had very, very busy schedules (possibly teaching as many as 56 lessons per week). If you're going to be a Hogwarts teacher you probably want to pick one of the less popular optional subjects (such as Muggle Studies) and avoid one of the core subjects like Transfiguration.