I'm trying to replace an old fixture for cosmetic reasons. Unfortunately I've pulled apart the wiring to the old fixture and don't remember how it all connected. The wiring in the ceiling has the above setup. The fixture itself has the standard 1 white, 1 black, and 1 ground wire. I followed [this](https://www.justanswer.com/electrical/7qoiv-white-wires-black-wires-light-fixture.html) advice...now the light operates from a different switch from before. 

I don't understand the underlying wiring so I'm baffled by what's going on. 

Edit: here's a photo of the box: 
[![enter image description here](https://i.stack.imgur.com/K9Tas.jpg)](https://i.stack.imgur.com/K9Tas.jpg)

The marked black wire is hot - it lights up my tester when I connect it to any other wire when the breaker is on and the switch is off.