Align part to local grid on only 2 axis

Im trying to align a part to grid but ignore the grid on normals and only normals,

so it should be flush to the wall but snap to grid along the sides, kind of like placing a window in bloxburg

right now i convert to object space, round, then bring back to world space but i cant figure out how to ignore the alignment for the normals

local gridSize = 1

local function RoundNumber(Number)
	return math.floor((Number / gridSize) + 0.5) * gridSize

local function RoundVector(objectSpace)
	local X, Y, Z = RoundNumber(objectSpace.X), RoundNumber(objectSpace.Y), RoundNumber(objectSpace.Z)

return function (note, pos, obj, normal, walls)
	local objectSpace = obj.CFrame:PointToObjectSpace(pos)
	pos = obj.CFrame:PointToWorldSpace(RoundVector(objectSpace) )

	local cf =, pos + normal) 
	cf += note.CFrame.LookVector * note.Size.Z/2
	return cf

Using a hacky raycast method I got it to work but I want to do this the right way, here is a gif of the desired result: