I sometimes see square brackets used while quoting. My assumption is that they are replacing a pronoun with what the object of the pronoun, but I never know for sure because I don't usually get to see what the original quote looks like before the modification. What are these called and what are the rules of use?
These are used to indicate that a direct quote has been edited — to fit the surrounding information, or to add context that does not show up within the scope of the quote. This page has a more detailed description:
Square brackets are used around words that are added that are not part of the original quote. For instance, you might have a source that says "Brenda and David went to the store," but you only want the quote to refer to David as a pronoun in your quote. So you should change it to "[He] went to the store."
Brackets can also be used with quotes for explanation for how you changed the quote from the original source. For example, you might write "Brenda and David went to the store [emphasis added]."
The cited page has apparently been moved and edited. As of 14 June 2023, it can be found (with changes) at https://askus.library.wwu.edu/faq/116674. It seems to be titled "Q. How should I use square brackets in quotes with APA style?", published by Western Washington University's Western Libraries, and dated 3 January 2020. It cites section 9.21 on page 292 of the APA Manual (7th Edition).
They are simply used to add contextual clarity where the meaning is unclear. This is not only in quotes, but that's its most common usage:
Original: "I returned there yesterday, 2 hours after it happened"
Quote: The criminal admitted: "I returned [to the crime scene] yesterday, 2 hours after [the murder] happened"
Square brackets are not ONLY used in quotes. They are used often in translation. For example, the bible. Although not all bibles do this, one notable bible that did do this was "The Geneva Bible"
The Geneva Bible translators gave particular attention to retaining the flavor and sense of the original Hebrew. Words that the translators considered to be necessary additions were shown in italics, and text that had been added for grammatical clarity appeared in square brackets.
Example: Daniel 1:7
And to them the principal court official went assigning names. So he assigned to Daniel [the name of] Bel‧te‧shaz′zar; and to Han‧a‧ni′ah, Sha′drach; and to Mish′a‧el, Me′shach; and to Az‧a‧ri′ah, A‧bed′ne‧go.
Square brackets, whether part of a quote or just in text simply mean: "Added for contextual accuracy"