When planning validation rules, I think it can be best to enumerate (or at least consider) all the possible actions that a user might attempt to take, and make a clear decision on which should be blocked and which should not.
It seem like you have 4 fields, two of which seem to be more important than the others (mandatory). So let’s call the fields M1, M2, O1 and O2 (optional fields).
Each field can go from empty to filled (E→F), filled to empty (F→E) or its value can be changed (FC) or unchanged (EUC or FUC).
Here’s an example of an action event:
M1 (E→F)
M2 (EUC)
O1 (FC)
O2 (FUC)
This notation means mandatory field 1 is being filled with a value, at the same time that optional field 1 is having its value changed. M2 remains empty and O2 keeps the same (non-empty) value.
Assuming that you can enumerate all the possibilities (and decide which should be blocked and which not) then defining the necessary validation rule(s) shouldn’t be that hard 
Note: At this stage, it doesn’t really matter whether the user is making the changes with a button or on the UI, but I can understand that you might end up defining validation rules such that a user can only do a specific desirable action via a button (i.e. an action that requires simultaneous updates to multiple fields)
Anyway, as I see it, your need is somewhat described here:
but I am uncertain of the details - it seems ambiguously worded.
“If the User wants to clear the 4 fields” - do you mean ‘if the user wants to clear any of the 4 fields’? or ‘if the user wants to clear all of the 4 fields’?
“when Field A and Field B are set, it should not possible to change them individually.” - what is ‘them’ in this sentence? Do you mean ‘it should not be possible to change either of Field A or Field B’ or ‘it should be not possible to change any of the aforementioned 4 fields’?
Anyway, maybe there’s a top level use case you could provide which might help us align on what is being worked towards… an example of what the ultimate goal is - maybe with more meaningful names that ‘mandatory field A’(!) - so that we’re in the same headspace