The two main characters are around age 13. They find? steal? a time machine from someone and end up back in Medieval England. But it's not them exactly - their consciousnesses get put into other bodies. The protagonist finds himself in some knight's body, while the deuteragonist initially gets put into the knight's horse! Later he gets thrown into the knight's squire (and the squire is mid-sentence when it happens, it's a rather bizarre scene).
Aside from the fish-out-of-water aspects, the main conflict is some evil knight, who eventually challenges knight-boy to a duel. I'm pretty sure the kid wins, but I don't remember the rest of the plot, and I don't remember how they get back to their own bodies and time.
I seem to remember that when the two are discussing whether to actually use the time machine, they talk about how the protagonist has hatched a lot of hair-brained schemes, including trying to sell some gross treats that turned out to be "worse, not better, than they looked." That might all be from another book entirely though.
I want to say the deuteragonist's name was Max.
This book was adapted into an animated film (not feature length - it might have been an episode in an anthology series) that I remember watching too. In it there's some knight with chicken pox, and he tells people not to touch him because he's cursed with "little red itchy dots."
I would have read this book sometime prior to 2000, probably more c. 1996.