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, https://gyazo.com/cd8c3eaa6e84b2317f1c05326abcde25

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
end

local function RoundVector(objectSpace)
	local X, Y, Z = RoundNumber(objectSpace.X), RoundNumber(objectSpace.Y), RoundNumber(objectSpace.Z)
	return Vector3.new(X,Y,Z)
end

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

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

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: https://gyazo.com/80d5f1b174d54ab5f5a18b98631e9ae5