I remember reading a fantasy book back in the 80s, although it felt older than that. It was about a man from our world (an engineer, maybe?) who had figured out the formulas to do magic through his engineering knowledge. He used it to go back in time and to other worlds, IIRC. I’m very vague on actual plotlines, but I do remember an exchange he had with a man in a Roman town who was complaining that the Romans wouldn’t let his co-religionists oppress “those heathens” of some sort.
For some reason, my brain keeps throwing up the name “Harold O’Shea” as the antagonist, although nothing in the vein I’m looking for comes up when I google that.