Consolidate partial-matching rows - add unique cells to previous matching rows

What would be the formula to compare cells in a row (A1:D1) against the rows directly below (A2:D2, A3:D3…), and if any rows match A1:D1 then insert values of the trailing cells (E2:H2, E3:H3, E4:H4…) to the end of that first matching row into I1:…, if those values are not already present there. Then go on and compare the next row to the ones below, and insert any trailing cells of those rows to the end of that row if the values are not already present in column I:…, and so on down…
Thanks!

Example:
(numbers in red are duplicates and not to be copied)
Consolidate partial-matching rows - example